package com.example.github.io.stream.filter;

import java.io.*;

/**
 * Java FilterInputStream类实现了InputStream。它包含不同的子类，
 * 如BufferedInputStream, DataInputStream，以提供额外的功能。所以它很少单独使用。
 */

public class FilterInputStreamExample {
    public static void main(String[] args) throws IOException {
        File file = new File("D:/logs/test1.txt");
        FileInputStream fis = new FileInputStream(file);
        FilterInputStream bis = new BufferedInputStream(fis);
        int i;
        while ((i = bis.read()) != -1) {
            System.out.print((char) i);
        }
        bis.close();
        fis.close();
        System.out.println();
        System.out.println("FilterInputStreamExample success ...");
    }
}
